package com.gxuwz.cyhschool;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class cashier extends AppCompatActivity implements View.OnClickListener {

    private Button  btn_cashier;

    private TextView tv_10;
    Double money;
    int pay = 1;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cashier);
        getSupportActionBar().hide();
        getSupportActionBar().hide();
        Intent intent = getIntent();
        String s = intent.getStringExtra("money");
        money = Double.parseDouble(s);
        btn_cashier = findViewById(R.id.btn_cashier);
        tv_10 = findViewById(R.id.tv_10);
        btn_cashier.setOnClickListener(this);
        tv_10.setText("￥" + money.toString() + "元");
        ImageView imageView=findViewById(R.id.iv_return);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        Button button=findViewById(R.id.btn_cashier);
        Intent intent1=new Intent(cashier.this,MainActivity.class);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(intent1);
            }
        });
    }


    @Override
    public void onClick(View v) {

        switch (v.getId()) {
            case R.id.iv_return:
                this.finish();
                return;

            case R.id.btn_cashier:
                Intent intent = new Intent();
                switch (pay) {
                    case 1:
                        Toast.makeText(cashier.this,"农业银行付款成功",Toast.LENGTH_SHORT).show();
                        break;
                    case 2:
                        Toast.makeText(cashier.this,"微信支付成功",Toast.LENGTH_SHORT).show();
                        break;
                    case 3:
                        Toast.makeText(cashier.this,"支付宝支付成功",Toast.LENGTH_SHORT).show();
                        break;
                }
                intent.setClass(cashier.this, balance.class);
                intent.putExtra("money",money);
                startActivity(intent);
                return;
        }
    }

}